<?php
$count = count($packages);
$s = 0;
$values = array();
foreach ($packages as $pa) {
    $values[$s++] = unserialize($pa->values);
}
?>
<h1><span class="ico_createstore"></span><?= lang('label_membership'); ?></h1>

<ul class="breadcrumb">
    <li><a href="<?= base_url() ?>"><?= lang('label_home') ?></a></li>
    <li><?= lang('label_membership') ?></li>
</ul>

<div class="page">
    <table id="table1">
        <thead>
            <tr>
                <th><span><?= lang('label_features') ?></span></th>
                <?php foreach ($packages as $package) { ?>
                    <td><span class="<?= $package->css ?>"><?= $package->title ?></span></td>
                <?php } ?>
            </tr>
        </thead>

        <tbody>
            <?php foreach ($pdetails as $pde) { ?>
                <tr>
                    <td><?= $pde->title ?></td>
                    <?php for ($i = 0; $i < $count; $i++) { ?>
                        <td><?php
                            $val = $values[$i][$pde->name];
                            if ($val == 'false')
                                echo '<span class="ico_false"></span>';
                            elseif ($val == 'true')
                                echo '<span class="ico_true"></span>';
                            else {
                                if (is_numeric($val)) {
                                    if ($val == 0)
                                        echo '-';
                                    else
                                        echo $val;
                                }else {
                                    $val = explode('+', $val);
                                    $f = true;
                                    foreach ($val as $va) {
                                        if (lang('label_values_' . trim($va))) {
                                            if (!$f)
                                                echo '+';
                                            echo lang('label_values_' . trim($va));
                                        } else {
                                            if (!$f)
                                                echo '+';
                                            echo $va;
                                        }
                                        $f = false;
                                    }
                                }
                            }
                            ?></td>
                    <?php } ?>
                </tr>
            <?php } ?>
            <tr>
                <td><?= lang('label_item_price') . '/' . lang('label_rial') ?></td>
                <?php foreach ($packages as $package) { ?>
                    <td><?= $package->price ?></td>
                <?php } ?>
            </tr>
        </tbody>
    </table>
    <br />
    <div class="submit">
        <a href="<?= base_url('store/create/1') ?>" ><?= lang('label_create_store') ?></a>
    </div>
    <br /><br />

</div>